package com.system.borrow.utils;

import android.app.Activity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.system.borrow.R;

/**
 * ================================================
 * 作    者：LuCenly(落尘)
 * 版    本：1.0
 * 创建日期：2016/11/22 14:27
 * 描    述：TODO
 * ================================================
 */
public class SecondTitle {
    private Activity context;
    public ImageView iv_left;
    public TextView tv_title;
    public TextView tv_right;
    public SecondTitle(Activity context) {
        this.context = context;
        initView(context);
        addListener();
    }

    private void addListener() {
        iv_left.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                context.finish();
            }
        });
    }
    public void setTitle(String title,String right){
        if(title!=null){
            tv_title.setText(title);
        }
        if(right!=null){
            tv_right.setText(right);
        }else{
            tv_right.setVisibility(View.GONE);
        }
    }
    private void initView(Activity context) {
        iv_left = (ImageView) context.findViewById(R.id.iv_left);
        tv_title = (TextView) context.findViewById(R.id.tv_title);
        tv_right = (TextView) context.findViewById(R.id.tv_right);
    }
}
